<!--
  分页列表的封装
-->
<template>

    <!--page-sizes：每页显示条数-->
    <!--current-page：当前页数-->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="CurrentChange"
      :current-page='this.page.pageNum'
      :page-sizes="[10, 2, 3, 4]"
      :page-size="this.page.pageSize"
      :total="this.page.count"
      layout="total,sizes, prev, pager, next, jumper">
    </el-pagination>
</template>

<script>
export default {
  name: "PagePagination",
  props: {page:{type:Object}},
  data() {
    return {
      rolePagePagin: {
        pageCno: this.page.pageNo,
        pageCsize: this.page.pageSize,
      }
    }
  },
  methods: {
    handleSizeChange(pageSize) {
      //console.log('size=', pageSize)
      this.rolePagePagin.pageCsize = pageSize
      //注意：将值传过去的时候，一定要写的是this.xxxx 这样在对，不然就会报错显示未定义
      this.$emit('pageChanged',this.rolePagePagin)
    },
    CurrentChange(pageNo) {
      //console.log('No=', pageNo)
      this.rolePagePagin.pageCno = pageNo
      this.$emit('pageChanged',this.rolePagePagin)
      //this.pagechange()
    }
  }
}
</script>

<style scoped>

</style>
